Repository navigation
fix: the User-Agent names the program running the CLI, given in REPLY_CLIENT - #33
Merged
Merged
Conversation
…_CLIENT The CLI names itself on every request as reply-cli/<version>, but a program that runs it for a person, such as an agent harness, could not say so, and Reply could not tell those calls apart from the person's own. REPLY_CLIENT, set to one product token and its version, now goes before the CLI's own token: REPLY_CLIENT=jason-harness/0.22.0 sends jason-harness/0.22.0 reply-cli/0.17.2. The release check sends the same User-Agent. A value that is not a lower-case name of up to 32 characters, a slash and a version of up to 32 is left out and the User-Agent stays as it was: the variable is a label, so it never refuses a command and never prints anything. The README lists it beside the other environment variables.
ArtemKosolap
enabled auto-merge
October 29, 2026 16:33
ArtemKosolap
disabled auto-merge
October 29, 2026 16:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: the User-Agent names the program running the CLI, given in REPLY_CLIENT
What changed
REPLY_CLIENT, read through the sameget_envas the otherREPLY_variables. When it holds one product token and its version,user_agent()puts it before the CLI's own token: withREPLY_CLIENT=jason-harness/0.22.0every request carriesUser-Agent: jason-harness/0.22.0 reply-cli/0.17.2. The CLI's token stays last.^[a-z][a-z0-9-]{0,31}/[0-9A-Za-z.+-]{1,32}$: a lower-case name of up to 32 letters, digits or dashes that starts with a letter, a/, and a version of up to 32 letters, digits, dots,+or-. No space, no second slash, nothing after the version.reply-cli/<version>, exactly as before. The variable is a label, not an input: it never refuses a command and never prints a notice.user_agent(), so it carries the same prefix.REPLY_CLIENTin the environment variables table, next toREPLY_NO_UPDATE_CHECK, with a paragraph on what it is for, its form, and that the Jason harness sets it.Why
The CLI already names itself on every request, and Reply logs that header. A program that runs the CLI on a person's behalf, such as an agent harness, had no way to say so, so Reply could not tell those calls apart from the person's own API work, per user and per version. A product token in front of the CLI's own is the usual way a User-Agent names the layer above it, and it needs no change on Reply's side to be read.
The check is strict because the value lands in a request header: a space, a line break or a second token would change what the header says. A value that fails the check is dropped silently rather than refused, so a typo in a wrapper never stops a command from running.
How it was verified
npm run build && npm test: before, 928 passed and 5 skipped; after, 932 passed and 5 skipped.user_agent()read the variable.src/__tests__/config.test.ts:reply-cli/<version>, unchanged;jason-harness/0.22.0,a/1,x9/1.0.0-rc.1+build.7, a 32-character name with a 32-character version, andmy-tool/V2are each put beforereply-cli/<version>;;, and a non-ASCII letter in the name or the version;user_agent()reads the process environment.src/__tests__/utils/client.test.ts: a request made withREPLY_CLIENT=jason-harness/0.22.0carriesjason-harness/0.22.0 reply-cli/<version>, and one made with a malformed value carriesreply-cli/<version>.fetchstubbed. No call reaches Reply.